{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a5fd2f66-c0b2-484b-9069-426a15dd39dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 3, 5, 7, 9])"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 从数值范围创建数组\n",
    "import numpy as np\n",
    "n1 = np.arange(1, 11, 2)\n",
    "n1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "31f57fb4-078b-4e0e-bce5-1e7f2d688aaa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 7500.,  8000.,  8500.,  9000.,  9500., 10000.])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# linspace函数创建等差数列\n",
    "n2=np.linspace(7500, 10000, 6)  # endpoint=True表示包含stop（终止值），6表示是创建6个\n",
    "n2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "be37108b-81e2-48a6-a1d3-1a8d37552392",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([                  1,                   2,                   4,\n",
       "                         8,                  16,                  32,\n",
       "                        64,                 128,                 256,\n",
       "                       512,                1024,                2048,\n",
       "                      4096,                8192,               16384,\n",
       "                     32768,               65536,              131072,\n",
       "                    262144,              524288,             1048576,\n",
       "                   2097152,             4194304,             8388608,\n",
       "                  16777216,            33554432,            67108864,\n",
       "                 134217728,           268435456,           536870912,\n",
       "                1073741824,          2147483648,          4294967296,\n",
       "                8589934592,         17179869184,         34359738368,\n",
       "               68719476736,        137438953472,        274877906944,\n",
       "              549755813888,       1099511627776,       2199023255552,\n",
       "             4398046511104,       8796093022208,      17592186044416,\n",
       "            35184372088832,      70368744177664,     140737488355328,\n",
       "           281474976710656,     562949953421312,    1125899906842624,\n",
       "          2251799813685248,    4503599627370496,    9007199254740992,\n",
       "         18014398509481984,   36028797018963968,   72057594037927936,\n",
       "        144115188075855872,  288230376151711744,  576460752303423488,\n",
       "       1152921504606846976, 2305843009213693952, 4611686018427387904,\n",
       "       9223372036854775808], dtype=uint64)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 数组的元素是一个等比数列\n",
    "n3=np.logspace(0,63, 64, base=2, dtype='uint64')\n",
    "n3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9438f209-76c0-4c7f-83ce-02c803933b35",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
